package com.yunxi.controller.sto;

import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.sto.pojo.StoReceiveRecordQueryVO;
import com.yunxi.sto.service.StoReceiveRecordDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 渠道商车辆签收记录 前端控制器
 * </p>
 *
 * @author caoYong
 * @since 2019-06-10
 */
@RestController
@RequestMapping("/admin/stoReceiveRecord")
@Api(tags = "sto:receiveRecord", description = "渠道商车辆签收记录接口")
public class StoReceiveRecordController {
 private static final Logger logger = LoggerFactory.getLogger(StoReceiveRecordController.class);

 @Autowired
 StoReceiveRecordDubboService stoReceiveRecordDubboService;

 @GetMapping("/page")
 @ApiOperation(value = "查询分页")
 @ApiImplicitParams({
         @ApiImplicitParam(paramType="query", name = "pageNum", value = "分页页码", required = true, dataType = "int"),
         @ApiImplicitParam(paramType="query", name = "pageSize", value = "分页数量", required = true, dataType = "int")
 })
 public ApiResult page(StoReceiveRecordQueryVO stoReceiveRecordQueryVO, Integer pageNum, Integer pageSize) throws Exception {
  return ResponseUtil.ok(stoReceiveRecordDubboService.findPageByVO(stoReceiveRecordQueryVO,pageNum,pageSize));
 }

 @GetMapping("/load")
 @ApiOperation(value = "读取单个")
 @ApiImplicitParam(paramType="query", name = "receiveRecordId", value = "主键id", required = true, dataType = "String")
 public ApiResult load(String receiveRecordId, @CurrentUser LoginInfo loginInfo) throws Exception {
  return ResponseUtil.ok(stoReceiveRecordDubboService.getById(receiveRecordId));
 }

 /*@PostMapping("/save")
 @ApiOperation(value = "保存信息")
 public ApiResult save(@RequestBody StoReceiveRecordVO stoReceiveRecordVO, @CurrentUser LoginInfo loginInfo) throws Exception {
  stoReceiveRecordDubboService.saveOrUpdate(stoReceiveRecordVO);
  return ResponseUtil.ok("success");
 }

 @PostMapping("/del")
 @ApiOperation(value = "删除")
 public ApiResult del(@RequestBody List<StoReceiveRecordVO> stoReceiveRecordVOList) throws Exception {
  stoReceiveRecordDubboService.removeByListVo(stoReceiveRecordVOList);
  return ResponseUtil.ok("success");
 }*/

/*@PostMapping("/export")
@ApiOperation(value = "导出excel")
public Object export(@RequestParam Map<String,Object> params) throws Exception {
return ResponseUtil.ok(stoReceiveRecordDubboService.findMapByList(params));
}*/
}
